#pragma once

#include <QtGui/QWidget>
#include <Engine/Engine.hpp>

#include "exports.hpp"




namespace QtUi
{
	class QTUI_API GraphicsWidget
		: public QWidget
	{
		Q_OBJECT

	public:

		GraphicsWidget(QWidget* parent);
		GraphicsWidget(const EngineInfo& info, QWidget* parent);
		virtual ~GraphicsWidget();

		Engine::IEngine::ptr engine() const;

	public slots:

		void onUpdate();

	protected:

		virtual bool event(QEvent* event);
		virtual void resizeEvent(QResizeEvent* event);
		virtual void contextMenuEvent(QContextMenuEvent *event);

	private:

		Engine::IEngine::ptr createEngine();
		Engine::IEngine::ptr createEngine(EngineInfo info);

	private:

		bool                         m_winIdChanged;

		Engine::IEngine::ptr         m_engine;
		Engine::Video::Device::ptr   m_videoDevice;

		QTimer                       m_timer;
	};
	///////////////////////////////////////////////////////////////////////////////////////////////
}
///////////////////////////////////////////////////////////////////////////////////////////////////
